<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../src//lala-ui.css">
    <title>Toast提示组件</title>
</head>
<body>
    <div class="tt-content">
        <div class="tt-panel-title">Toast提示组件</div>
        <div class="tt-panel-body">
            <a class="tt-btn tt-btn-primary" id="js-show-toast-loading">加载中提示</a>
            <br>
            <a class="tt-btn tt-btn-primary" id="js-show-toast-success">成功提示</a>
        </div>
    </div>
    <div class="tt-toast" id="tt-toast-loading">
        <i class="fa fa-spinner fa-spin tt-toast-icon"></i>
        <p class="tt-toast-info">操作进行中</p>
    </div>

    <div class="tt-toast" id="tt-toast-success">
        <i class="fa fa-check tt-toast-icon"></i>
        <p class="tt-toast-info">操作成功</p>
    </div>

    <script>
        window.onload = () => {
            // 显示加载中的Toast
            document.querySelector('#js-show-toast-loading').onclick = (e) => {
                let toastEle = document.querySelector('#tt-toast-loading');
                toastEle.classList.add('show');
                setTimeout(() => {
                    toastEle.classList.remove('show');
                },2e3)
            }
            // 显示成功的Toast
            document.querySelector('#js-show-toast-success').onclick = (e) => {
                let toastEle = document.querySelector('#tt-toast-success');
                toastEle.classList.add('show');
                setTimeout(() => {
                    toastEle.classList.remove('show');
                },2e3)
            }
        }
    </script>
</body>
</html>